package jfprincesstests.fakes;

import jfuzzyprincepless.zarchive.algorithm.structure.ICommandConstruction;
import jfuzzyprincepless.negotiation.IExecutionContext;

public class FakeActivationCmd
	implements ICommandConstruction
{
	private boolean active = false;
	private ICommandConstruction subcommand;

	public FakeActivationCmd(
		ICommandConstruction subcommand
	) {
		this.subcommand = subcommand;
	}

	@Override
	public void execute(IExecutionContext context) {
		if (!active) {
			return;
		}
		active = false;
		subcommand.execute(context);
	}

	public void activate() {
		active = true;
	}
}
